/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ssm.changeunit;

import com.ssm.changeunit.persistance.ChangeLogDAO;
import com.ssm.changeunit.persistance.ChangeLogDTO;
import com.ssm.changeunit.persistance.PersistanceException;

/**
 *
 * @author 시리우스
 */
public class ChangeLog extends AbstractProduct {
    private String changeLogId;
    
    private ChangeLogDAO changeLogDAO;
    
    /**
     * 생성자
     * 
     * @param changeLogId
     */
    public ChangeLog(String changeLogId) {
        this.changeLogId = changeLogId;
        
        this.changeLogDAO = new ChangeLogDAO();
    }

    public String getChangeLogId() {
        return changeLogId;
    }
    
    public String getFilePath() throws PersistanceException {
        return changeLogDAO.find(changeLogId).getChangeLogId();
    }
    
    public void setFilePath(String filePath) throws PersistanceException {
        ChangeLogDTO changeLogDTO = changeLogDAO.find(changeLogId);
        
        changeLogDTO.setFilePath(filePath);
        
        changeLogDAO.update(changeLogDTO);
    }
    
    public byte[] getContent() throws PersistanceException {
        return changeLogDAO.find(changeLogId).getContent();
    }
    
    public void setContent(byte[] content) throws PersistanceException {
        ChangeLogDTO changeLogDTO = changeLogDAO.find(changeLogId);
        
        changeLogDTO.setContent(content);
        
        changeLogDAO.update(changeLogDTO);
    }
}